1. Technical Field
The present invention relates to a network transmission technique, and more particularly, to a method for offloading packet segmentations.
2. Background
In network communication protocol, transmission control protocol (TCP) and internet protocol (IP) are two of the most important protocols called TCP/IP, wherein the transmission control protocol puts a transmission control protocol header to the beginning of transmit data and becomes a transmission control protocol segment. The transmission control protocol segment puts an internet protocol header to the beginning of transmit data and becomes an internet protocol packet.
Offloading is a mechanism to transfer parts of tasks to a network interface device, such as a network interface card, to reduce the load of the central processing unit (CPU). Segmentation is a mechanism to segment a packet to a plurality of sub-packets for data transmission. TCP segmentation offloading (TSO) combines advantages of two methods to segment by the network interface device. In one implementation, a content of a transmission control segment is segmented into a plurality of segments, and assigns the internet protocol header based on an original internet protocol header. FIG. 1 shows the diagram for offloading a TCP segmentation. Referring to FIG. 1, the length of the internet protocol packet is 64 KB, including the internet protocol header, the transmission control protocol header and the payload. The payload of the internet protocol packet is segmented into 46 parts (in FIG. 1, n equal to 46) by the TCP segmentation. Accordingly, the internet protocol packet is segmented into 46 sub-packets with the length of 1448 byte, wherein each sub-packet also includes the internet protocol header, the transmission control protocol header and the payload. The CPU can finish a 64 KB packet transmission by a transmit command through the TCP segmentation offloading mechanism.
For the network interface device of a bus master with a direct memory access, the packet is transmitted by a pointer of a transmit descriptor to retrieve a transmit packet. FIG. 2 shows a diagram of the transmit descriptor. As shown in FIG. 2, the transmit descriptor stores a plurality of pointers, each pointing to the packet to be transmitted in the memory. To support the TCP segmentation offloading mechanism, the network interface device needs the packet segmentation offloading parameter, which includes packet segmentation data such as the maximum segment size data. Most of the traditional TCP segmentation offloading mechanism uses the descriptor to carry the network segmentation offloading parameter.
FIG. 3 shows a diagram for offloading the TCP segmentation according to the prior art. Referring to FIG. 3, the TCP segmentation offloading mechanism changes the descriptor architecture, and each pointer saves extra packet segmentation offloading parameter corresponding to the packet. However, the network interface device with the traditional TCP segmentation offloading mechanism must be compatible with the descriptor architecture, and changing the descriptor architecture increases system bus usage and decreases memory efficiency.
FIG. 4 shows a diagram for offloading the TCP segmentation according to another prior art. Referring to FIG. 4, the TCP segmentation offloading mechanism also changes the descriptor architecture, and the descriptor sequentially stores packet pointers and the corresponding packet segmentation offloading parameter. However, this TCP segmentation offloading mechanism still increases system bus usage and decreases memory efficiency.
FIG. 5 shows a diagram for offloading the TCP segmentation according to another prior art. Referring to FIG. 5, the TCP segmentation offloading mechanism puts the packet segmentation offloading parameter at the beginning of each packet, i.e., increasing the length of the packet to carry the packet segmentation offloading parameter. However, this kind of TCP segmentation offloading mechanism may not be implemented in most operating systems, and the increased length decreases the memory efficiency.
FIG. 6 shows a diagram for offloading the TCP segmentation according to the prior art. Referring to FIG. 6, the TCP segmentation offloading mechanism changes the description architecture, which stores the packet segmentation offloading parameter in corresponding pointer of the packet. Unlike the method in FIG. 3, the transmit descriptor does not sequentially store the pointer of the packet and the packet segmentation offloading parameter. However, the network interface device corresponding to such TCP segmentation offloading mechanism must be capable of distinguishing the pointer from the packet segmentation offloading parameter, and therefore would increase the design complexity.
The traditional TCP segmentation offloading mechanism is shown in FIG. 3 to FIG. 6, which all increases system bus usage and decreases memory efficiency. Moreover, the network interface device of a bus slave with the direct memory access, such as universal serial bus (USB) with remote network driver interface specification (Remote NDIS), can not change the specification and architecture; consequently, not suitable for the above TCP segmentation offloading mechanisms.
Accordingly, the industry needs a method and a device for offloading packet segmentations, without changing the present descriptor architecture to effectively achieve the TCP segmentation offloading, so as to be suitable for network interface devices of the bus slave with no direct memory access.